<template>
  <div class="box">
    <h1>这是B组件,{{ n }}</h1>
    <el-button type="primary" size="default" @click="handleMinus">-</el-button>
    <div v-for="item in goodStu">
      姓名:{{ item.name }} 成绩:{{ item.score }}
    </div>
  </div>
</template>

<script setup>
import { computed } from "vue";
import { useStore } from "vuex";
const store = useStore();
const n = computed(() => store.state.num);
// const goodStu = computed(() => store.state.stu.filter((item) => item.score >= 60));
const goodStu = computed(() => store.getters.goodStu);
const handleMinus = () => {
  store.commit("minus");
};
</script>

<style lang="scss" scoped>
.box {
  width: 50%;
  height: 500px;
  border: 1px solid #333;
}
</style>
